import React, { Component } from 'react'

export default class VoteHeader extends Component {
    componentDidMount(){
        const { store } = this.props;
        // 订阅事件
        store.subscribe(()=>this.forceUpdate())
    }
    render() {
        const { store } = this.props;
        const { title, suppNum, oppNum } = store.getState();
        return (
            <div>
                <h1>{title}</h1>
                <p>NUM:{suppNum + oppNum}</p>
            </div>
        )
    }
}
